package com.dream.controller;

import com.dream.common.annotation.ApiDecrypt;
import com.dream.common.annotation.ApiEncrypt;
import com.dream.common.wrap.R;
import com.dream.model.dto.UserBody;
import com.dream.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 用户controller
 * @author: LiMG
 * @create: 2025-05-09 10:52:23
 **/
@Tag(name = "用户操作")
@ApiEncrypt
@ApiDecrypt
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/register")
    @Operation(summary = "注册用户", description = "注册用户")
    public R register(@RequestBody UserBody userBody) {
        userService.register(userBody);
        return R.ok().setData("注册成功");
    }

    @GetMapping("/getUserInfo")
    @Operation(summary = "获取用户信息", description = "获取用户信息")
    public R getUserInfo() {
        UserBody userBody = userService.getUserInfo();
        return R.ok().setData(userBody);
    }

}
